/* GMProductImages.js <?php
#   --------------------------------------------------------------
#   GMProductImages.js 2011-01-24 gambio
#   Gambio GmbH
#   http://www.gambio.de
#   Copyright (c) 2011 Gambio GmbH
#   Released under the GNU General Public License (Version 2)
#   [http://www.gnu.org/licenses/gpl-2.0.html]
#   --------------------------------------------------------------
?>*/
/*<?php
if($GLOBALS['coo_debugger']->is_enabled('uncompressed_js') == false)
{
?>*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('3 y(){6.z=3(a,b){$(\'A\').B(\'<n o="8"></n>\');$(\'#8\').9({C:\'D\',E:\'F\',G:\'H\',I:\'p%\',4:\'p%\'});2 c=J;2 d=0;2 e=K.L.M();i(e.j("q")>-1&&e.j("N")==-1){2 f=e.j("q")+5;i(e.O(f,1)<7){$(\'.P\').9({Q:\'R\'})}}$(\'#8\').S(\'T.U?V=r&W=\'+a+\'&X=\'+b,\'\',3(){k.s();k.l(b);Y.Z(1,1)});10.11(\'#8\');$(\'#12\').9({13:\'14\'});i($(t).4()>$(\'#h\').4()){2 g=$(t).4()}15{2 g=$(\'#h\').4()+16}$(\'#17\').9({4:g+\'18\'})};6.l=3(a){2 b=\'#19\'+a;2 c=$(b).u(\'a\').m(\'1a\');c=c.v(\'/\');c=c[c.1b-1];$(\'#h w\').1c(\'x\');$(b).1d(\'x\');$(\'#1e\').u(\'1f\').m(\'1g\',\'1h/r/1i/\'+c)};6.s=3(){$(\'#h w\').1j(3(e){2 a=$(6).m(\'o\');2 b=a.v(\'1k\');b=b[1];k.l(b)})}}',62,83,'||var|function|height||this||product_images_layer|css||||||||product_images_box|if|indexOf|gmProductImages|activate_image|attr|div|id|100|msie|product_images|bind_fn|document|find|split|li|active|GMProductImages|open_images|body|append|position|absolute|left|0px|top|50px|width|95|navigator|userAgent|toLowerCase|opera|substr|lightbox_visibility_hidden|visibility|hidden|load|gm_ajax|php|module|pID|image_nr|window|scrollTo|gmLightBox|load_box|menubox_gm_scroller|display|none|else|200|__dimScreen|px|image_|href|length|removeClass|addClass|active_image|img|src|images|popup_images|click|_'.split('|'),0,{}));
/*<?php
}
else
{
?>*/
function GMProductImages()
{

	this.open_images = function(products_id, image_number)
	{
//		$('.wrap_site').append('<div id="product_images_layer"></div>');
		$('body').append('<div id="product_images_layer"></div>');
		$('#product_images_layer').css(
		{
			position: 	'absolute',
			left: 			'0px',
			top: 				'50px',
			width: 			'100%',
			height: 		'100%'
		});

		var test_products_id 	= 95;
		var test_image_nr 		= 0;

		var user_agent = navigator.userAgent.toLowerCase();
		if(user_agent.indexOf("msie") > -1 && user_agent.indexOf("opera") == -1){
			var msie_index = user_agent.indexOf("msie") + 5;
			if(user_agent.substr(msie_index,1) < 7){
				$('.lightbox_visibility_hidden').css(
				{
					visibility: 	'hidden'
				});
			}
		}

		$('#product_images_layer').load('gm_ajax.php?module=product_images&pID='+ products_id +'&image_nr='+ image_number,
																			'',
																			function(){
																				gmProductImages.bind_fn();
																				gmProductImages.activate_image(image_number);
																				window.scrollTo(1, 1);
																			});
		gmLightBox.load_box('#product_images_layer');

		// BOF MOD by PT
		$('#menubox_gm_scroller').css({
			display: 'none'
		});

		if($(document).height() > $('#product_images_box').height()) {
			var pt_height = $(document).height();
		} else {
			var pt_height = $('#product_images_box').height()+ 200;
		}
		$('#__dimScreen').css({ height: pt_height + 'px'});
		// EOF MOD by PT

	}


	this.activate_image = function(image_number)
	{
		var active_li 			= '#image_' + image_number;
		var active_img_name = $(active_li).find('a').attr('href');

		//IE6 patch:
		active_img_name = active_img_name.split('/');
		active_img_name = active_img_name[active_img_name.length - 1];

		$('#product_images_box li').removeClass('active');
		$(active_li).addClass('active');

		$('#active_image').find('img').attr('src', 'images/product_images/popup_images/' + active_img_name);
	}

	this.bind_fn = function()
	{
		$('#product_images_box li').click(function(e)
		{
			var li_id 		= $(this).attr('id');

			var image_nr	= li_id.split('_');
			image_nr			= image_nr[1];

			gmProductImages.activate_image(image_nr);
		});
	}

}
/*<?php
}
?>*/
